package com.gallop.common.lock;

public class DistributedConstants {

    @FunctionalInterface
    public interface LockPrimaryKey {

        static DistributedConstants.LockPrimaryKey wrap(String primaryKey) {
            return () -> primaryKey;
        }

        String toPrimaryKeyString();
    }

    public enum LockPrimaryKeyEnum implements LockPrimaryKey {
        DEFAULT,
        ;

        @Override
        public String toPrimaryKeyString() {
            return name();
        }
    }

    @FunctionalInterface
    public interface OnSuccess {
        void execute() throws Exception;
    }

    @FunctionalInterface
    public interface OnFail {
        void handle(String key);
    }

    @FunctionalInterface
    public interface OnError {
        void handle(Throwable ex);
    }
}
